package tralala.client.remote;

import tralala.server.remote.ITralalaManager;

public class RMIServiceLocator {

	private ITralalaManager service;
	
	//Crear una nueva instancia de RMIServiceLocator
	public RMIServiceLocator()
	{
		
	}
	
	public void setService(String ip, String port, String serviceName) 
	{
	// Add your code to get the TARGET reference HERE    	
	try {
		String name = "//" + ip + ":" + port + "/" + serviceName;
		service = (ITralalaManager) java.rmi.Naming.lookup(name);
	} catch (Exception e) {
		// TODO Auto-generated catch block
		System.err.println("- Exception running the client: " + e.getMessage());
		e.printStackTrace();
	}
	}
	
	public ITralalaManager getService() {    	
    	// Add your code to return the TARGET reference HERE
    	return service;
    }
}
	